package gui;

import javax.swing.JPanel;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import com.jgoodies.forms.factories.FormFactory;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class AppPanelLocation extends JPanel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 3532086094480804100L;
	public static JButton btnChapterCreate = new JButton("Create");
	public static JButton btnChapterDelete = new JButton("Delete");
	public static JButton btnChapterEdit = new JButton("Save");
	public static JTextField txtLocShortName = new JTextField();
	public static JTextField txtLocName = new JTextField();
	public static JScrollPane scrollLoc = new JScrollPane();
	public static JTextArea taLocDesc = new JTextArea();
	public static JLabel lblLocCity = new JLabel("City:");
	public static JLabel lblLocCountry = new JLabel("Country:");
	public static JScrollPane scrollLocAddress = new JScrollPane();
	public static JTextArea taLocAddress = new JTextArea();
	public static JTextField txtLocCity = new JTextField();
	public static JTextField txtLocCountry = new JTextField();
	public static JLabel lblLocFullAddress = new JLabel("Full Address");
	public static JTextField txtLocMap = new JTextField();
	public static JTextField txtLocWeb = new JTextField();
	public static JTextField txtLocImage = new JTextField();
	public static JButton btnLocImage = new JButton("Select Image");
	public static JButton btnLocWeb = new JButton("Add Weblink");
	public static JButton btnLocMap = new JButton("Add Maplink");
	private final JLabel lblShortname = new JLabel("Shortname");
	private final JLabel lblName = new JLabel("Location Name");
	
	
	
	/**
	 * Create the panel.
	 */
	public AppPanelLocation() {
		txtLocImage.setColumns(10);
		txtLocCountry.setColumns(10);
		txtLocCity.setColumns(10);
		txtLocName.setText("Name");
		txtLocName.setColumns(10);
		txtLocShortName.setText("ShortName");
		txtLocShortName.setColumns(10);
		setLayout(new FormLayout(new ColumnSpec[] {
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("75px"),
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("default:grow"),
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("default:grow"),
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,
				FormFactory.RELATED_GAP_COLSPEC,
				ColumnSpec.decode("default:grow"),
				FormFactory.RELATED_GAP_COLSPEC,
				FormFactory.DEFAULT_COLSPEC,},
			new RowSpec[] {
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				RowSpec.decode("default:grow"),
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,
				FormFactory.RELATED_GAP_ROWSPEC,
				FormFactory.DEFAULT_ROWSPEC,}));
		
		add(lblShortname, "4, 2");
		
		add(lblName, "6, 2");
		add(btnChapterEdit, "2, 4");
		
		add(txtLocShortName, "4, 4, fill, default");
		
		add(txtLocName, "6, 4, 5, 1, fill, default");
		btnChapterDelete.setMnemonic('D');
		add(btnChapterDelete, "2, 6");
		
		add(scrollLoc, "4, 6, 7, 5, fill, fill");
		taLocDesc.setLineWrap(true);
		
		scrollLoc.setViewportView(taLocDesc);
		btnChapterCreate.setMnemonic('C');
		add(btnChapterCreate, "2, 8");
		
		add(lblLocCity, "4, 12");
		
		add(lblLocFullAddress, "6, 12");
		
		add(scrollLocAddress, "6, 14, 5, 5, fill, fill");
		taLocAddress.setLineWrap(true);
		taLocAddress.setFont(new Font("Monospaced", Font.PLAIN, 11));
		taLocAddress.setWrapStyleWord(true);
		
		scrollLocAddress.setViewportView(taLocAddress);
		
		add(txtLocCity, "4, 14, fill, default");
		
		add(lblLocCountry, "4, 16");
		
		add(txtLocCountry, "4, 18, fill, default");
		txtLocMap.setColumns(10);
		
		add(txtLocMap, "4, 20, 3, 1, fill, default");
		
		add(btnLocMap, "8, 20");
		txtLocWeb.setColumns(10);
		
		add(txtLocWeb, "4, 22, 3, 1, fill, default");
		btnLocWeb.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		
		add(btnLocWeb, "8, 22");
		
		add(txtLocImage, "4, 24, 3, 1, fill, default");
		
		add(btnLocImage, "8, 24");
		
		txtLocMap.setVisible(false);
		btnLocMap.setVisible(false);
	}

}
